//
//  ConfirmViewController.m
//  FengyuanXS
//
//  Created by 王冬 on 2020/7/25.
//  Copyright © 2020 王冬. All rights reserved.
//

#import "ConfirmViewController.h"
#import "RegisterViewController.h"
#import "ForgetPassController.h"
@interface ConfirmViewController ()
@property (weak, nonatomic) IBOutlet UITextField *nameText;
@property (weak, nonatomic) IBOutlet UITextField *icCardText;

@end

@implementation ConfirmViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor = [UIColor whiteColor];
    
    // [self.navigationController.navigationBar setBackgroundImage:[UIColor imageWithColor:[UIColor whiteColor]] forBarMetrics:UIBarMetricsDefault];    // Do any additional setup after loading the view.
}
-(void)viewWillAppear:(BOOL)animated{
    [super viewWillAppear:animated];
    self.navigationController.navigationBar.hidden = NO;
}
- (IBAction)commitBtn:(BoardButton *)sender {
    
    [[ApiManager ShardInstance]authNmae:self.nameText.text iccard:self.icCardText.text type:self.type resultBlock:^(NSDictionary *data, NSError *error) {
      
        
        
        BaseModel *model = [BaseModel mj_objectWithKeyValues:data];
        if (model.code == 1) {
            UserModel *model = [UserModel mj_objectWithKeyValues:data[@"rs"]];
            if ([self.type isEqualToString:@"0"]) {
                ForgetPassController *forgetVC = [ForgetPassController loadStroyboard:[ForgetPassController new]];
                forgetVC.phone = model.mobile;
                forgetVC.userid = model.id;
                [self.navigationController pushViewController:forgetVC animated:YES];
            }else{
                RegisterViewController *registerVC = [RegisterViewController loadStroyboard:[RegisterViewController new]];
                registerVC.model = model;
                [self.navigationController pushViewController:registerVC animated:YES];
            }
            
        }else{
            [[ToastManager shardInstance]showToast:model.msg];
        }
        
        
        
    }];
}


/*
 #pragma mark - Navigation
 
 // In a storyboard-based application, you will often want to do a little preparation before navigation
 - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
 // Get the new view controller using [segue destinationViewController].
 // Pass the selected object to the new view controller.
 }
 */

@end
